package com.gitee.wsl.struct.command.testing

/*
import com.gitee.wsl.struct.command.model.parameters.options.delegate.option
import com.gitee.wsl.test.shouldBe
import kotlin.js.JsName
import kotlin.test.Test

class TestingUtilsTest {
    @Test
    @JsName("testing_envvar")
    fun `testing envvar`() {
        class C : TestCommand(called = false) {
            val o1 by option()
            val o2 by option(envvar = "O")

            override fun run_() {
                o1 shouldBe "foo"
                o2 shouldBe "bar"
                echo("$o1")
                echo("$o2")
            }
        }

        val result = C().test("--o1=foo", envvars = mapOf("O" to "bar"))
        result.stdout shouldBe "foo\nbar\n"
        result.stderr shouldBe ""
        result.output shouldBe "foo\nbar\n"
        result.statusCode shouldBe 0
    }

    @Test
    @JsName("testing_error")
    fun `testing error`() {
        @Suppress("unused")
        class C : TestCommand(called = false) {
            val o by option()
        }

        val ex = """
            |Usage: c [<options>]
            |
            |Error: no such option --foo. Did you mean --o?
            |
        """.trimMargin()
        val result = C().test("--foo bar", stdin = "unused")
        result.stdout shouldBe ""
        result.stderr shouldBe ex
        result.output shouldBe ex
        result.statusCode shouldBe 1
    }

    @Test
    @JsName("testing_with_prompt")
    fun `testing with prompt`() {
        class C : TestCommand() {
            val o1 by option().prompt()
            val o2 by option().prompt()

            override fun run_() {
                o1 shouldBe "foo"
                o2 shouldBe "bar"
                echo("err", err = true)
            }
        }

        val result = C().test("", stdin = "foo\nbar")
        result.stdout shouldBe "O1: O2: "
        result.stderr shouldBe "err\n"
        result.output shouldBe "O1: O2: err\n"
        result.statusCode shouldBe 0
    }

    @Test
    @JsName("test_TerminalInfo_configuration")
    fun `test TerminalInfo configuration`() {
        class C : TestCommand() {
            override fun run_() {
                with(currentContext.terminal.info) {
                    ansiLevel shouldBe AnsiLevel.NONE
                    width shouldBe 11
                    height shouldBe 22
                    ansiHyperLinks shouldBe true
                    outputInteractive shouldBe true
                    inputInteractive shouldBe true
                }
            }
        }
        C().test(
            "",
            ansiLevel = AnsiLevel.NONE,
            width = 11,
            height = 22,
            hyperlinks = true,
            outputInteractive = true,
            inputInteractive = true,
        )
    }
}*/
